<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var sum = 0;
        // var arr = [45,56,78,88,89,90,100,89];
        // for (var i = 0; i <= arr.length - 1; i++){
            // sum += arr[i];
        // }
        // console.log(sum);

        var sum = 0;
        var arr = [45,56,78,88,89,90,100,89];
        for (var i = 0; i <= arr.length - 1; i++){
            sum += arr[i];
        }
        console.log("这个班级的总分是"+ sum +"分" );
        var v = sum / arr.length;
        console.log("这个班级的是"+ v + "分");
   
   
   

    </script>
</body>
</html>